<cfscript>    
    view = createObject("component", session.rootDir & ".views.layout");
    if( Session.Auth EQ True and (Session.strAuthType EQ Session.IT or Session.strAuthType EQ Session.HR) ){
        view.init("Step 5: Employee Number Update",
            "/jquery/ui-1.8.5/jquery-ui.min.js,/jquery/plugins/scrollTo/jquery.scrollTo-1.4.2-min.js, /" & session.rootDir & "/static/js/SCF/Step5-EmployeeNumberUpdate.js",
            "/jquery/ui-1.8.5/themes/cupertino/jquery-ui.css","Home",main);
    }else{
        view.init("Denied","","","Home","Denied");
    }    
    view.html();
</cfscript>

<cffunction name="main" access="public" output="true" returntype="any">
    <cfscript>
        import models.*;
        KronosQueries = CreateObject("component", session.rootDir & ".DatabaseQueries.Kronos");
        AccessControlQueries = CreateObject("component", session.rootDir & ".DatabaseQueries.AccessControl");
        if( isDefined('URL.StepID') ){
            StepActions = ORMExecuteQuery("FROM StepActions WHERE StepActionsID = " & URL.StepID & " AND ActTimeStamp IS NULL");
        }else{
            StepActions = ORMExecuteQuery("FROM StepActions WHERE StepsID = 6 AND ActTimeStamp IS NULL AND TermReqID IS NULL");
            URL.StepID = -1;
        }
        FormAction = '/' & Session.RootDir & "/controller/SubmitHandler.cfm?SCFStep5=update";
    </cfscript>
    <h1 class="title">Step 5: Employee Number Update</h1>
    <div class="entry">
        <cfform name="frmStep5" method="post" action="#FormAction#">        
            <p>
            Welcome, #Session.EmpInfo.FirstName# #Session.EmpInfo.LastName#.  
            In this step, provide the Navigator Employee numbers as determined 
            when they are added to Navigator.
            </p>

            <cfinput type="hidden" name="StepID" value="#URL.StepID#" />    
            <table width = 100%>
                <tr>
                    <td colspan="3"><span class="tableHeader">Finance Creation Report</span></td>
                    <td align="right" ><a href="PrintFinanceReport.cfm?SCF=1" target="_blank">Print Report</a></td>
                </tr>
            </table>
            
            <table width=100%>
                <tr> 
                    <td><strong><u>Name, Job Title, &amp; Department</u></strong></td>
                    <td><strong><u>New Employee Number</u></strong></td>
                    <td><strong><u>Comments</u></strong></td>
                </tr>

                <cfloop from="1" to="#ArrayLen(StepActions)#" index="i">
                	<cfset Employee = ORMExecuteQuery("FROM Employee WHERE EmployeeID = " & StepActions[i].getEmployeeID() & " AND NonSCFTypeID IS NULL") />
                    <cfset PositionInfo = KronosQueries.funcGetPositionInfo(Employee[1].getPositionID()) />
                    <cfset Depts = KronosQueries.funcGetDepts(Employee[1].getDepartmentID()) />
                    <tbody id="#StepActions[i].getStepActionsID()#" class="EmployeeNumber">
                        <tr> 
                            <td nowrap="nowrap">#Employee[1].getFirstName()# #Employee[1].getLastName()#</td>
                            <td >
                                <cfinput type="text" name="EmployeeNumber" error_message="The employee number for '#Employee[1].getFirstName()# #Employee[1].getLastName()#' 
                                    is required and must be numeric."/>
                                <cfinput type="hidden" name="RosettaID" value="#Employee[1].getRosettaID()#" />
                            </td>
                            <td><cfinput type="text" name="comments" /></td>                        
                        </tr>
                    </tbody>
                </cfloop>
                <tr>
                    <td colspan="3">&nbsp;</td>
                </tr>
                <tr>
                    <td colspan="3" align="right">
                        <cfinput type="hidden" name="FormIndicator" value="0">
                        <cfinput type="hidden" name="FormAction" value="#FormAction#">
                        <cfinput type="button" name="Submit" value="Submit">
                    </td> 
                </tr>
            </table>            
        </cfform>
    </div>        

</cffunction>